#include<stdio.h>
#include<math.h>

double funF(double x);
double funG(double x);
int main(void)
{
	float input;
	double ans;
	scanf("%f",&input);
	
	ans=funF(funG(input));
	
	printf("%.2lf\n",ans);
	
	return 0;
}
double funF(double x)
{
	return fabs(x-3)+fabs(x+1);
}
double funG(double x)
{
	return x*x-3*x;
}
